package net.huashitong.Indicators.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.Indicators.dao.AreaCodeDao;
import net.huashitong.Indicators.dao.HotWordDao;
import net.huashitong.Indicators.entity.AreaCode;
import net.huashitong.Indicators.entity.HotWord;
import net.huashitong.Indicators.filter.HotWordFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HotWordsService extends StringPKService<HotWord> {
    @Override
    protected BaseDao<HotWord, String> getDao() {
        return dao;
    }
    @Autowired
    private HotWordDao dao;

    @Autowired
    private SysTableService tableService;

    @Override
    protected void beforeSave(HotWord obj) {
        obj.setSysId(tableService.updateMaxSysId("BA02", null));
    }
    /**
     * 条件查询
     * @param filter
     * @return
     */
    public List<HotWord> queryHotWords(HotWordFilter filter){
        return dao.queryHotWords(filter);
    }

    public List<HotWord> queryRandom(){
        return dao.queryRandom();
    }
}
